﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.Runtime.Remoting.Messaging;
using DLMemberPointMS.Entity.POCOModel;
using System.Web;

namespace DLMemberPointMS.Business
{
    public class ContextFactory : DbContext
    {
        public static DbContext GetCurrentContext()
        {
            //从线程中取出dbcontext
            DbContext context = CallContext.GetData("DLMPMSModel") as DbContext;
            //如果获取不到
            if (context == null)
            {
                context = new DLMPMSModel();//从DLMPMSModel中取出dbcontext
                CallContext.SetData("DLMPMSModel", context);
            }
            return context;
        }
    }
}
